package cn.edu.java.stream.functionalinterface;

import java.util.function.Function;

public class FunctionDemo {
    public static void main(String[] args) {
        Function<Integer, String> function1 = new Function<Integer, String>() {
            @Override
            public String apply(Integer number) {
                return "Result: " + number;
            }
        };

        String result1 = function1.apply(5);
        System.out.println(result1);

        Function<Integer, String> function2 = (number) -> "Result: " + number;

        String result2 = function2.apply(5);
        System.out.println(result2);


    }
}
